//:C06:Transform.cpp {-mwcc}
// Use of STL transform() algorithm.
// {L} Counted
#include <iostream>
#include <vector>
#include <algorithm>
#include "Counted.h"
using namespace std;

template<class T> 
T* deleteP(T* x)
{
    delete x; 
    return 0;
}

template<class T>
struct Deleter
{
    T* operator()(T* x)
    {
        delete x;
        return 0;
    }
};

int main(void)
{
    CountedVector cv("one");
    transform(cv.begin(), cv.end(), cv.begin(), deleteP<Counted>);
    CountedVector cv2("two");
    transform(cv2.begin(), cv2.end(), cv2.begin(), Deleter<Counted>());
}